﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using ClassLibrary.BLL;

namespace ClassLibrary.DAL
{
    public class DALKhachHang
    {
        //public static List<BLLKhachHang> GetByID(int _id)
        //{

        //}



        internal List<BLLKhachHang> GetByID(int _id)
        {
            var result = from kh in DALCommon.NonDB.KhachHangs
                         where kh.IDKhach == _id
                         select
                         new BLLKhachHang(kh.Username, kh.Password, kh.HoTen, kh.Email, kh.DiaChi, Convert.ToInt32(kh.SDT));
            return result.ToList<BLLKhachHang>();
        }

        internal static bool Checklogin(BLLKhachHang user)
        {
            var user_account = from us in DALCommon.NonDB.KhachHangs
                               where (us.Username.Equals(user.UserName)) && (us.Password.Equals(user.Pass))
                               select us;
            if (user_account.Count() == 0)
            {
                return false;
            }
            else return true;
        }
    }
}
